import 'package:environmental_les_app/common/routes/route_names.dart';
import 'package:environmental_les_app/common/style/colours.dart';
import 'package:environmental_les_app/common/widgets/search_entry_widget.dart';
import 'package:flutter_clx_base/flutter_clx_base.dart';

import 'index.dart';

class OrganizationPage extends GetView<OrganizationController> {
  const OrganizationPage({super.key});

  // 主视图
  Widget _buildView() {
    return Column(
      children: [
        const SearchEntryWidget(hintText: "搜索联系人"),
        _buildOrganizationItem(),
        _buildOrganizationItem(),
        _buildOrganizationItem(),
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<OrganizationController>(
      init: OrganizationController(),
      id: "organization",
      builder: (_) {
        return MyScaffold(
          title: "鄂尔多斯市生态环境局准格尔旗分局",
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }

  // 组织架构 item

  Widget _buildOrganizationItem() {
    return InkWell(
      onTap: () {
        Get.toNamed(AppRoutes.departmentPage);
      },
      child: Container(
        margin: const EdgeInsets.only(top: 10, left: 10, right: 10),
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(8),
        ),
        padding: const EdgeInsets.all(12),
        child: Row(
          children: [
            ImageWidget.loadAssetImage("ic_organization_people",
                height: 40, width: 40),
            hGap10,
            const Text("大气科",
                style: TextStyle(
                    color: Colours.textC4C,
                    fontSize: 16,
                    fontWeight: FontWeight.w500)),
            hGap10,
            const Text("(19)",
                style: TextStyle(color: Colours.text969, fontSize: 16)),
            const Spacer(),
            const Icon(
              Icons.keyboard_arrow_right,
              color: Colours.text09C,
              size: 26,
            )
          ],
        ),
      ),
    );
  }
}
